import { Pagination, Table } from 'antd';
import { memo } from 'react';
import styles from './index.module.scss';

const BasicTable = ({
	page = {
		current: 1,
		pageSize: 10,
		total: 100,
	},
	height = '152px',
	...props
}) => {
	return (
		<div className={styles.tableWrapper}>
			<Table
				style={{
					height: `calc(100vh - ${height})`,
				}}
				bordered
				scroll={{ y: `calc(100vh - ${height} - 55px)`, x: '100%' }}
				pagination={false}
				{...props}
			/>
			<div className={styles.paginationWrapper}>
				<Pagination
					current={page.current}
					pageSize={page.pageSize}
					total={page.total}
					showSizeChanger
					showQuickJumper
					onChange={(page, pageSize) => console.log(page, pageSize)}
					showTotal={(total) => `共 ${total} 条`}
				/>
			</div>
		</div>
	);
};

export default memo(BasicTable);
